#include <cstdio>

int a[ 1000 ], n;

void round( )
{
    int b[ 1000 ], i, t;
    for ( i = 0; i < n; i++ )
    {
        t = i + 1;
        if ( i == n - 1 )
            t = 0;
        b[ t ] = a[ t ] / 2 + a[ i ] / 2;
        b[ t ] += b[ t ] & 1;
    }
    for ( i = 0; i < n; i++ )
        a[ i ] = b[ i ];
}

bool check( )
{
    int i;
    for ( i = 1; i < n; i++ )
        if ( a[ i ] != a[ 0 ] )
            return false;
    return true;
}

int main( )
{
    int i, count;
    while( scanf("%d", &n) && n )
    {
        for ( i = 0; i < n; i++ )
            scanf("%d", &a[ i ]);
        count = 0;
        while( 1 )
        {
            round( );
            count++;
            if ( check( ) )
                break;
        }
        printf("%d %d\n", count, a[ 0 ]);
    }
    return 0;
}
